import React from 'react';
import { connect } from 'dva';
import { ListView, Icon, Badge } from 'antd-mobile';
import avatar from '../../../../../../../../framework/utils/avatar';
import styles from './myCollectionItem.css';
// import btnTypes from './btnListJson';

// import check from '../../../../../../../../icons/personal/checked-icon.png';

const MyCollectionItem = ({
  item={},
  onViewMember=()=>{},
  showLimit=()=>{},
}) => {

  const renderAge = (birthday) => {
    if (birthday && birthday != '') {
      return date.age(birthday) + "岁";
    }
  }
  const baseStyle = {
    backgroundColor: 'transparent',
    borderRadius: 4,
    color: '#333',
    marginRight: 10,
  };
  const boxStyle = {
    ...baseStyle,
    lineHeight:'20px',
    color: '#ABABAB',
    border: '1PX solid #ABABAB',
    fontSize: '10px',
  };

  const click1 = () =>{
    console.log('click1');
  }
  const click2 = () =>{
    console.log('click2');
  }
  const click3 = () =>{
    console.log('click3');
  }

  const btnClickType = (clickType) =>{
    if(clickType == 1){
      return click1();
    }

    if(clickType == 2){
      return click2();
    }

    if(clickType == 3){
      return click3();
    }
  }

  const showBtn = (partTimeType)=>{
    let btnList = null;
    if(partTimeType == 1){
      btnList = btnTypes.signUpBtnsJson();
    }else if(partTimeType == 2){
      btnList = btnTypes.admissionBtnsJson();
    }else if(partTimeType == 3){
      btnList = btnTypes.workBtnsJson();
    }else if(partTimeType == 4){
      btnList = btnTypes.settlementBtnsJson();
    }


    return btnList.map((btnItem, btnIndex) => {
      return (
        <div key={btnItem.id.toString()}
          className={styles.btnItem}
          onClick={() => btnClickType(btnItem.clickType)}
          >
          <span>{btnItem.label}</span>
          {btnItem.showPartingLine ? (
            <div className={styles.partingLine}>
              <div className={styles.lineBody}></div>
            </div>
          ):''}
        </div>
      )
    })
  }

  return (
    <div key={item.id.toString()} >
      <div className={styles.content}>
        <div className={styles.avatar} onClick={() => showLimit()}>{avatar(item.typeName, item.avatar)}</div>
        <div className={styles.detail} onClick={() => onViewMember(item.job.id)}>
          <div className={styles.item}>
            <div className={styles.name}>
              <span>{item.job.title}</span>
              {item.status=="AUDITING"?(<span className={styles.status}>已报名</span>):''}
              {item.status=="UNSEEMLINESS"?(<span className={styles.status}>不合适</span>):''}
              {item.status=="PASS"?(<span className={styles.status}>已录用</span>):''}


            </div>
            <div className={styles.price}>
                <span>{item.job.wage}/月 </span>
                <span className={styles.applyTime}>{item.applyTime} </span>
            </div>
            {/* <div className={styles.price}>3000/月</div> */}
          </div>
          <div className={styles.partTimeStatus}>
          {/*  待录用   */}

          </div>
        </div>
      </div>
    {/*    <div className={styles.btns}>
        {showBtn(2)}
      </div>
       */}
    </div>
  );
};

MyCollectionItem.propTypes = {
};

export default connect()(MyCollectionItem);
